package main

import (
	"fmt"
	"math"
)

type Point struct{ X, Y float64 }

func (p *Point) ScaleBy(factor float64) {
	p.X = factor
	p.Y = factor
}

func (p *Point) Distance(q Point) float64 {
	return math.Hypot(q.X-p.X, q.Y-p.Y)
}

type StringPoint struct {
	*Point
	string
	str string
}

func main() {
	p := StringPoint{&Point{1, 1}, "hello", "red"}
	q := StringPoint{&Point{5, 4}, "tom", "blue"}
	fmt.Println(p.Distance(*q.Point))
	q.Point = p.Point
	p.ScaleBy(2)
	fmt.Println(*p.Point, *q.Point)

}
